package com.itheima.text1;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class Demo2 {
    public static void main(String[] args) {

        //参数为最大值
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService;

        System.out.println(pool.getPoolSize());//0

        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+ "线程执行");
        });

        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+ "线程执行");
        });

        System.out.println(pool.getPoolSize());
    }
}
